feat: remove hardcoded base token dependencies from the app#8160
feat: remove hardcoded base token dependencies from the app#8160
Conversation
packages/shared/lib/core/network/constants/default-network-metadata.constant.ts
Outdated
Show resolved
Hide resolved
| delete oldNetwork.baseToken | ||
|
|
||
| const newNetwork = oldNetwork as unknown as IPersistedNetwork | ||
| const defaultBech32Hrp = DEFAULT_NETWORK_METADATA[existingProfile.network.id]?.bech32Hrp || '' |
There was a problem hiding this comment.
In what cases would DEFAULT_NETWORK_METADATA[existingProfile.network.id]?.bech32Hrp not exist? I just because it seems weird to me to leave '' as fallback value, it will likely break if that ever happens.
| coinType: _coinType, | ||
| protocol: nodeInfoResponse?.nodeInfo?.protocol, | ||
| baseToken: { standard: TokenStandard.BaseToken, ...nodeInfoResponse?.nodeInfo?.baseToken }, | ||
| bech32Hrp: bech32Hrp ?? 'Unknown Network', |
There was a problem hiding this comment.
Why did you add 'Unknown Network' as fallback value here now? This will likely break it as well and it doesn't make sense to use a human-readable phrase for this either
|
|
||
| export const nodeInfoBaseToken = derived(nodeInfo, ($nodeInfo) => $nodeInfo?.baseToken) | ||
|
|
||
| export const nodeInfoProtocol = derived(nodeInfo, ($nodeInfo) => $nodeInfo?.protocol) |
There was a problem hiding this comment.
This is not used
| export const nodeInfoProtocol = derived(nodeInfo, ($nodeInfo) => $nodeInfo?.protocol) |
| return nodeInfo.set(newNodeInfo) | ||
| } | ||
|
|
||
| export const nodeInfoBaseToken = derived(nodeInfo, ($nodeInfo) => $nodeInfo?.baseToken) |
There was a problem hiding this comment.
What's the point of this store? You don't seem to be reading it from any svelte file so all the reactivity features it comes with are effectively not used at all, thus it seems more appropiate to me to just read the nodeInfo store
| function showRewardsFoundNotification(updatedTotalUnclaimedShimmerRewards: number): void { | ||
| const foundRewardsAmount = updatedTotalUnclaimedShimmerRewards - totalUnclaimedShimmerRewards | ||
| const foundRewardsAmountFormatted = formatTokenAmountBestMatch(foundRewardsAmount, getOnboardingBaseToken()) | ||
| const foundRewardsAmountFormatted = formatTokenAmountBestMatch(foundRewardsAmount, getBaseToken()) |
There was a problem hiding this comment.
This will break because there is no Node Info loaded in the onboarding, it's only loaded once you log in.
…evelop' of github.com:iotaledger/firefly into feat/remove-hardcoded-base-token-dependencies
|
🫡 |
Closes #8132
Summary
Get the node's base token information instead of getting the hardcoded default information
Changelog
Testing
Platforms
Checklist